
import java.util.ArrayList;

public class UserList implements Users
{
	private ArrayList<Client> clientList;
	private Client client;
	public UserList( ArrayList<Client> clientList )
	{
		this.clientList = clientList;
	}
	@Override
	public void registerUser(Observer o) 
	{
		this.client = (Client) o;
		clientList.add(client);
	}
	@Override
	public void removeUser(Observer o) 
	{
		int i = clientList.indexOf(o);
		clientList.remove(i);
	}
	@Override
	public void updateUsers(String message)
	{
		for(int i = 0; i<clientList.size(); i++)
		{
			clientList.get(i).update(message);
		}
	}	
}
